{# **
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://devdocs.prestashop.com/ for more information.
 *
 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 * #}
{% extends '@PrestaShop/Admin/layout.html.twig' %}
{% trans_default_domain 'Admin.Advparameters.Feature' %}

{% block content %}
  <div class="alert alert-info" role="alert">
    <p class="alert-text">
      {{ 'PrestaShop provides numerous APIs if you need you can see their details in the dedicated automated documentation:'|trans({}, 'Admin.Advparameters.Feature') }}
      <ul>
        <li>
          <a target="_blank" href="{{ path('api_doc', {_format: 'html'}) }}">
            {{ 'API Documentation (Swagger)'|trans({}, 'Admin.Advparameters.Feature') }}
          </a>
        </li>
        <li>
          <a target="_blank" href="{{ path('api_doc', {_format: 'html', ui: 're_doc'}) }}">
            {{ 'API Documentation (ReDoc)'|trans({}, 'Admin.Advparameters.Feature') }}
          </a>
        </li>
        <li>
          <a target="_blank" href="{{ path('api_doc', {_format: 'json'}) }}">
            {{ 'API Documentation (JSON)'|trans({}, 'Admin.Advparameters.Feature') }}
          </a>
        </li>
      </ul>
    </p>
  </div>

  {% if isAdminAPIMultistoreDisabled %}
    <div class="alert alert-danger" role="alert">
      <p class="alert-text">
        {{ 'The use of multistore and Admin API is an experimental feature. You need to
        enabled the "Admin API - Multistore" functionality in'|trans({}, 'Admin.Advparameters.Feature') }}
        <a href="{{ path('admin_feature_flags_index') }}">
          {{ 'New & Experimental Features'|trans({}, 'Admin.Navigation.Menu') }}
        </a>
      </p>
    </div>
  {% endif %}

  {% block api_client_listing %}
    {{ include('@PrestaShop/Admin/Common/Grid/grid_panel.html.twig', {grid: apiClientGrid}) }}
  {% endblock %}

  {# Configuration form #}
  {{ form_start(configurationForm, {attr: {class: 'form'}, action: path('admin_api_clients_process_configuration')}) }}
  {% block administration_form_general %}
    <div class="card" id="configuration_fieldset_general">
      <h3 class="card-header">
        <i class="material-icons">settings</i>
        {{ 'Configuration'|trans({}, 'Admin.Global') }}
      </h3>
      <div class="card-body">
        <div class="form-wrapper">
          {{ form_widget(configurationForm) }}
        </div>
      </div>
      <div class="card-footer">
        <div class="d-flex justify-content-end">
          <button type="submit" class="btn btn-primary">{{ 'Save'|trans({}, 'Admin.Actions') }}</button>
        </div>
      </div>
    </div>
  {% endblock %}
  {{ form_end(configurationForm) }}
{% endblock %}

{% block javascripts %}
  {{ parent() }}
  <script src="{{ asset('themes/default/js/bundle/pagination.js') }}"></script>
  <script src="{{ asset('themes/new-theme/public/api_client.bundle.js') }}"></script>
{% endblock %}
